#!/usr/bin/python
import re, os, sys, getopt

from ipl import *
from mxd import *
from checker import *
from builder import *

def main():
	try:
		opts, args = getopt.getopt(sys.argv[1:], 'hl:')
	except getopt.GetoptError, err:
		print str(err)
		sys.exit(1)
	
	checker = geo_checker([ipl_helper_cli(),mxd_helper_cli(),])
	for opt, arg in opts:
		if opt == '-l':
			 checker.learn(arg)
		elif opt == '-h':
			print 'Usage: [-l db_samples] database'
		else:
			print 'unhandled option'
			sys.exit(2)

	for arg in args:
		helper = checker.run(arg)
		builder = geo_builder(helper)
		builder.load(arg)
		del builder
	sys.exit(0)

if __name__ == '__main__':
    main()

